<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
	<meta charset="UTF-8">
	<title></title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap-dropdown.js"></script>
	<style type="text/css">
		body{
			margin-top:50px;
		}
		input,
		.page-header{
			background-color:rgb(240, 245, 248);
		}
		
		#beijing{
			width:400px;
			height:100px;
		}
		
	</style>
	
</head>
<body>
	<div class="navbar navbar-fixed-top">
	  <div class="navbar-inner">
		<div class="container">
			<a class="brand" href="#">
			  <img src="img/user_group.png" alt="" />&nbsp;客户关系管理系统
			</a>
			<ul class="nav">
			  <li>
				<a href="welcome.action">概览</a>
			  </li>
			  <li><a href="contacts.action">通讯录</a></li>
			  <li><a href="tasks.action">任务</a></li>
			  <li><a href="chances.action">机会</a></li>
			  <li><a href="discuss.action">讨论</a></li>
			  <li class="dropdown" id="menutest1">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest1">
				  添加
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				  <li><a href="new_contact.action"><i class="icon-user"></i>&nbsp;联系人</a></li>
				  <li><a href="new_company.action"><i class="icon-home"></i>&nbsp;公司</a></li>
				  <li class="divider"></li>
				  <li><a href="new_task.action"><i class="icon-ok"></i>&nbsp;任务</a></li>
				  <li  class="active"><a href="new_chance.action"><i class="icon-star-empty"></i>&nbsp;机会</a></li>
				</ul>
			  </li>
			  
			</ul>
			
			<ul class="nav pull-right" >
			  <li>
				<a href="#">${user.username }</a>
			  </li>
			  <li class="dropdown" id="menutest2">
				<a class="dropdown-toggle" data-toggle="dropdown" href="#menutest2">
				  管理
				  <b class="caret"></b>
				</a>
				<ul class="dropdown-menu">
				   <li><a href="manage_user.action?id=${sessionScope.user.id }"><i class="icon-user"></i>&nbsp;同事</a></li>
				  <li><a href="manage_group.action"><i class="icon-list-alt"></i>&nbsp;组</a></li>
				  <li class="divider"></li>
				<!--  <li><a href="user_update_user.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li> -->
				  <li><a href="show_user_msg.action?id=${sessionScope.user.id }"><i class="icon-asterisk"></i>&nbsp;账号</a></li>
				</ul>
			  </li>
			  <li class="divider-vertical"></li>
			  <li><a href="sign_in.action">退出</a></li>
			</ul>
			
		</div>
	  </div>
	</div>
	
	<div class="container">
		
			<div class="row">
				  <div class="span2"></div>
				  <div class="span8">
					
						<div class="page-header well">
						  <h2><img src="img/company.png" alt="" />&nbsp;添加机会</h2>	
						</div>	
						
	<div class="page-header well">
		<form class="form-horizontal" action="sav.action?id=${user.id }" method="POST"  >
		
		  <fieldset>
			<legend>完善资料</legend>
			
			<div class="control-group">
			  <label class="control-label">联系人</label>
			  <div class="controls">
				<input type="text" name="contactsname">
			  </div>
			</div>
			<div class="control-group">
			  <label class="control-label">机会名称</label>
			  <div class="controls">
				<input type="text" name="deal.title" id="title">
			  </div>
			</div>
			
			<div class="control-group">
			  <label class="control-label">金额</label>
			  <div class="controls">
				<input type="text" name="deal.money" id="money">
			  </div>
			</div>
			
			<div class="control-group">
			  <label class="control-label">状态</label>
			  <div class="controls">
			<div class="statetype">
						<select name="statetype" id="statetype">
								<option value="跟踪">跟踪</option>
							</select>
					</div>
			  </div>
			</div>
			
			<div class="control-group">
			  <label class="control-label">机会描述或背景信息</label>
			  <div class="controls">
				<textarea id="beijing" rows="20"cols="40" name="deal.content"></textarea>
			  </div> 
			</div>
			
				<div class="control-group">
			  <label class="control-label">谁可以看见？</label>
			  <div class="controls">
				
				<input class="nogroup" type="Radio" name="view" value="all"   class="">所有同事<br/>
				<input class="nogroup" type="Radio" name="view" value="me" checked="checked">只有我能看见<br/>
				<input id="checkgroup" type="Radio" name="view" value="grouptype" >选择一个组...<br/>
					
					<div class="grouptype" style="display:none">
						<select name="grouptype" id="grouptype">
							<c:forEach items="${userGroupList }" var="list">
								<option value="${list.groupname }">${ list.groupname}</option>
							</c:forEach>
							</select>
					</div>
				 
			  </div> 
			</div>
			
			<div class="control-group">
			  <label class="control-label"></label>
			  <div class="controls">
				<button class="btn btn-primary" type="submit">
				  保存机会
				</button>
				<a class="btn btn-success" href="#" id="saves">
				  保存并添加机会
				</a>
				</form> 
			  </div> 
			</div>
			</fieldset>
	</div>	
				  </div>
				  <div class="span4">
						<div class="page-header well">
							<table class="table">
							  <thead>
								<tr>
								  <th><h3>什么是机会?</h3></th>
								</tr>
							  </thead>
							  <tbody>
								<tr>
								  <td>机会即业务机会或商业机会，比如一笔可能成交的业务或项目。</td>
								 
								</tr>
								 <tr><td>机会通常跟一个联系人相关，您需要先将这个联系人添加到系统。</td></tr>
								 <tr><td>在输入联系人时，系统会根据已输入的内容自动查找联系人，并以下拉列表的形式显示出来，您可以从中选取一个。</td></tr>
								<tr><td>您可以根据自己的业务情况给机会添加分类。比如按产品分类、按重要程度或行业分类。</td></tr>
								  
							  </tbody>
							</table>
						</div>	
						</div>

		
	<script type="text/javascript">
		$(document).ready(function(){
		 $("#saves").click(function(){
		 
		     var title=$("#title").val();
		    var money=$("#money").val();
		    var state=$("#beijing").val();
		

  $.post("saves.action",{title:title,money:money,state:state},function(json){
		    
		 }); 
		
		 $("#saves").ajaxComplete(function(){
		    
		   $("input").attr("value","");
		    $("textarea").attr("value","");
		    
		 });
		    
		    });
		    
		    
		 	$("#checkgroup").click(function(){
				$(".grouptype").show(500);
			});
			$(".nogroup").click(function(){
				$(".grouptype").hide(500);
			});
		});
		
	</script>
</body>
</html>